package com.anolesoft.twelvePlan.mapper;

import com.anolesoft.twelvePlan.vo.StfEmployeeToChargeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zyq
 * @date 2022/3/25
 * 员工表下拉选
 */
@Mapper
public interface StfEmployeeToChargeMapper {
    // 计划核对负责人下拉选
    //@Select("select a.objuid, a.name from stf_employee a where a.delete_flag = 0 and a.factory_id = #{factoryId, jdbcType=VARCHAR}")
    @Select("select a.objuid, a.name" +
            "  from stf_employee a" +
            " where a.factory_id = #{factoryId, jdbcType=VARCHAR}" +
            "   and a.dept_id = (select b.objuid" +
            "                      from stf_dept b" +
            "                     where b.factory_id = #{factoryId, jdbcType=VARCHAR}" +
            "                       and b.dept_name = '调度室'" +
            "                       and b.delete_flag = 0)" +
            "   and a.delete_flag = 0")
    List<StfEmployeeToChargeVO> chargePerson(String factoryId);
    @Select("select a.objuid" +
            "  from stf_employee a" +
            " where a.factory_id = #{factoryId, jdbcType=VARCHAR}" +
            "   and a.name = #{name, jdbcType=VARCHAR}" +
            "   and a.delete_flag = 0")
    String chargePersonId(String factoryId, String name);
}
